using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;

namespace QLNS.Data
{
    public class LoaiQuanHe_db
    {
        Services m_Ds = new Services();
        public LoaiQuanHe_db() { }

        public DataTable DanhSachLoaiQuanHe()
        {
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM LOAIQUANHE");
            m_Ds.Load(cmd);

            return m_Ds;
        }
        public DataTable TimTheoTen(string name)
        {
            string sql = "SELECT * FROM LOAIQUANHE where Name like '%" + name + "%'";
            OleDbCommand cmd = new OleDbCommand(sql);
            m_Ds.Load(cmd);

            return m_Ds;
        }

        public DataTable TimTheoMa(string id)
        {
            string sql = "SELECT * FROM LOAIQUANHE where ID like '%" + id + "%'";
            OleDbCommand cmd = new OleDbCommand(sql);
            m_Ds.Load(cmd);

            return m_Ds;
        }

        public DataRow NewRow()
        {
            return m_Ds.NewRow();
        }

        public void Add(DataRow row)
        {
            m_Ds.Rows.Add(row);
        }

        public bool Save()
        {
            return m_Ds.ExecuteNoneQuery() > 0;
        }
    }
}
